﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using Commonlib;
namespace DAL
{
    public class SizeTempleteDAL
    {
        /// <summary>
        /// 获取全部sizetemplete数据
        /// </summary>
        public DataTable getTemplete(string limit)
        {
            string cmdstr = "select * from SizeTemplete where "+limit;
            return SqlHelper.ExecuteDataSet(SqlHelper.SqlConnectionString, CommandType.Text, cmdstr, null).Tables[0];
        }

        public void addTemplete(Albon.Model.SizeTemplete templete)
        {
            SqlParameter[] parameters = new SqlParameter[]{
					new SqlParameter("@styleID", templete.styleID),
					new SqlParameter("@ItemID",templete.ItemID),
					new SqlParameter("@bodyStatus", templete.bodyStatus),
					new SqlParameter("@finishedStatus", templete.finishedStatus),
            };
            SqlHelper.ExecuteNonQuery(SqlHelper.SqlConnectionString, CommandType.StoredProcedure, "p_templeteadd", parameters);
        }
        //active=0
        public void deleteTemplete(int styleid)
        {
            string cmdstr = "update SizeTemplete set active=0 where styleID="+styleid;
            SqlHelper.ExecuteNonQuery(SqlHelper.SqlConnectionString, CommandType.Text, cmdstr, null);
        }
    }
}
